<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
//判断一个整数，属于哪个范围：大于0；小于0；等于0
    // var num=-4;
    // if(num%1!==0){
    //     console.log("请输入整数");
    // }else if(num>0){
    //     console.log(num + ">0");
    // }else if(num==0){
    //     console.log(num + "=0");
    // }else(
    //     console.log(num + "<0")
    // )


/*开发一款软件，根据公式（身高-108）*2=体重，可以有10斤左右的浮动。来观察测试者体重是否合适
     var app = function(height,weight){
         num = (height-108)*2
         if(weight-10<num && weight+10>num){
             console.log("符合标准体重")
         }else{
             console.log("不符合标准体重")
         }
     }
     app(183,120);*/


/*// 输入分数，判定成绩等级 (只用 if 写法)
     var mark = 81;
     if(mark<60){
        console.log("成绩不合格")
     }else if(mark>=60 && mark<70){
        console.log("合格")
     }else if(mark>=70 && mark<80){
        console.log("良好")
     }else{
        console.log("优秀")
     }
*/



/*//输入月份，显示当月的天数 要求：利用case穿透简化代码
     var year = 4000;
     var month = 2;
     switch(month){
        case 1:
        case 3:  
        case 5: 
        case 7:
        case 8:
        case 10:
        case 12:
            console.log(month + "月31天")
            break;
        case 4:
        case 6:
        case 9:
        case 11:
            console.log(month + "月30天")
            break;
        case 2:
            if(year%4==0 && year%100!=0 || year%400==0){
                console.log(month + "月为29天")
            }else{
                console.log(month + "月为28天")
            }
            break;
     }
*/


/*// 根据输入的三个数字，判断是这一年的第几天
     var year=2022;
     var month=3;
     var day = 22;
     var total =0;
     switch(month-1){
        case 12:
            total+=31;
        case 11:
            total+=30;
        case 10:
            total+=31;
        case 9:
            total+=30;
        case 8:
            total+=31;
        case 7:
            total+=31;
        case 6:
            total+=30;
        case 5:
            total+=31;
        case 4:
            total+=30;
        case 3:
            total+=31;
        case 2:
            if(year%4==0 && year%100!=0 || year%400==0){
                total+=29
            }else{
                total+=28
            }
        case 1:
            total+=31;
     }
     console.log(total+=day)
     */
    // 第二种写法
    var year=Number(prompt("请输入年份"));
    var month=Number(prompt("请输入月份"));
    var day=Number(prompt("请输入天数"));
    var total=0;
    for(var i=month-1;i>0;i--){
        if(i==4||i==6||i==9||i==11){
            total+=30;
        }else if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
            total+=31;
        }else if(i==2&&year%4==0 && year%100!=0 || year%400==0){
            total+=29;
        }else{
            total+=28;
        }
    }
    alert(`是今年的${total+=day}天`)
    
</script>